package com.mrjy.maintain.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.SchoolTeam;
import com.mrjy.maintain.bo.ISchoolTeamBo;
@Controller
@RequestMapping("maintain/schoolTeam")
public class SchoolTeamController {
	@Resource
	private ISchoolTeamBo schoolTeamBo;
	/**
	 * 全部查询
	 * @return
	 */
	@RequestMapping("/schoolTeamList")
	@ResponseBody
	public Object SchoolTeamList(HttpSession session,SchoolTeam schoolTeam) {
		//int roleId = ((UserInfo) session.getAttribute(GlobalConstant.USER_INFO)).getRoleId();
		/*if(roleId!=1){
			schoolTeam.setSchoolId(((UserInfo) session.getAttribute(GlobalConstant.USER_INFO)).getSchoolId());
		}*/
		return schoolTeamBo.schoolTeamList(schoolTeam);
	}
	
	/**
	 * 分页查询
	 * @return
	 */
	@RequestMapping("/schoolTeamByPage")
	@ResponseBody
	public Object SchoolTeamByPage(HttpSession session,SchoolTeam schoolTeam) {
		//int roleId = ((UserInfo) session.getAttribute(GlobalConstant.USER_INFO)).getRoleId();
		/*if(roleId!=1){
			schoolTeam.setSchoolId(((UserInfo) session.getAttribute(GlobalConstant.USER_INFO)).getSchoolId());
		}*/
		return schoolTeamBo.schoolTeamByPage(schoolTeam);
	}
	
	/**
	 * 添加学校
	 * @return
	 */
	@RequestMapping("/addSchoolTeam")
	@ResponseBody
	public Object insert(SchoolTeam schoolTeam){
		schoolTeamBo.insert(schoolTeam);
		return "ok";
	}
	/**
	 * 根据ID查询
	 * @return
	 */
	@RequestMapping("/queryById")
	@ResponseBody
	public Object queryById(int id) {
		return schoolTeamBo.queryById(id);
	}
	/**
	 * 修改
	 * @param userTeam
	 * @return
	 */
	@RequestMapping("/updateById")
	@ResponseBody
	public Object updateById(SchoolTeam schoolTeam) {		
		schoolTeamBo.txUpdateById(schoolTeam);
		return "ok";
	}
	
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	@RequestMapping("/deleteByIds")
	@ResponseBody
	public Object deleteByIds(int[] ids) {		
		return schoolTeamBo.txDeleteByIds(ids);
	}
}
